package com.cheng.operation.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cheng.common.exception.CommonException;
import com.cheng.common.utils.StringUtil;
import com.cheng.data.entity.ArchiveTypeInfEntity;
import com.cheng.operation.ArchiveTypeInfOperation;
import com.cheng.service.ArchiveTypeInfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: ChengJW
 * @date: 2021/11/8 19:51
 * @version: 1.0
 * @description: 有关档案类型信息表 archive_type_inf 的逻辑操作
 */
@Service
public class ArchiveTypeInfOperationImpl implements ArchiveTypeInfOperation {

    private final static Logger log = LoggerFactory.getLogger(ArchiveTypeInfOperationImpl.class);

    @Autowired
    private ArchiveTypeInfService archiveTypeInfService;

    /**
     * @author: ChengJW
     * @params: []
     * @return: java.util.List<com.cheng.data.entity.ArchiveTypeInfEntity>
     * @date: 2021/11/8
     * @description: 查询 archive_type_inf 列表信息
     */
    @Override
    public List<ArchiveTypeInfEntity> queryArchiveTypeInf(ArchiveTypeInfEntity entity) throws CommonException {
        return archiveTypeInfService.queryArchiveTypeInf(entity);
    }

    /**
     * @author: ChengJW
     * @params: [code]
     * @return: java.lang.String
     * @date: 2021/11/8
     * @description: 根据 archive_type_inf 的档案类型代码，查询档案名称
     */
    @Override
    public String queryArchiveTypeInfNmByCode(String code) throws CommonException {

        ArchiveTypeInfEntity entity = new ArchiveTypeInfEntity();
        entity.setArTypeCode(code);
        List<ArchiveTypeInfEntity> list = archiveTypeInfService.queryArchiveTypeInf(entity);
        String archiveTypeNm = null;
        if (null != list && list.size() > 0){
            archiveTypeNm = list.get(0).getArTypeNm();
        }
        return archiveTypeNm;
    }
}
